package com.xuerhua.yxt.controller.sys.teacher;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xuerhua.yxt.common.RspResult;
import com.xuerhua.yxt.common.enums.Status;
import com.xuerhua.yxt.controller.BaseController;
import com.xuerhua.yxt.model.TeacherInfo;
import com.xuerhua.yxt.service.ITeacherService;

@RequestMapping("/sys/teacher/my")
@Controller
public class SysTeacherMyController extends BaseController {
	
	@Autowired
	private ITeacherService teacherService;
	
	@RequestMapping(value={"","/"})
	public String Index(Model model) {
		model.addAttribute("detail", teacherService.selectById(adminUser().getTeacherInfo().getId()));
		return "sys/teacher/my";
	}
	
	@RequestMapping("pageQuery")
	@ResponseBody Object pageQuery(){
		try {
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping("update")
	@ResponseBody Object update(TeacherInfo record) {
		try {
			record.setId(adminUser().getTeacherInfo().getId());
			teacherService.updateById(record);
			return new RspResult(Status.SUCCESS);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new RspResult(Status.FAIL);
	}
	
}
